home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wemdemo4.zip / INFO / DIRED.1 (.txt) < prev    next >
GNU Info File  |  1994-09-21  |  49KB  |  848 lines

  1. This is Info file ../info/dired, produced by Makeinfo-1.56 from the
  2. input file dired.txi.
  3.    This file documents Tree Dired, the GNU Emacs Directory Browser, and
  4. most of the extra features available as an option.
  5.    Copyright (C) 1991, 1992 Free Software Foundation
  6.    Permission is granted to make and distribute verbatim copies of this
  7. manual provided the copyright notice and this permission notice are
  8. preserved on all copies.
  9.    Permission is granted to copy and distribute modified versions of
  10. this manual under the conditions for verbatim copying, provided also
  11. that the section entitled "GNU General Public License" is included
  12. exactly as in the original, and provided that the entire resulting
  13. derived work is distributed under the terms of a permission notice
  14. identical to this one.
  15.    Permission is granted to copy and distribute translations of this
  16. manual into another language, under the above conditions for modified
  17. versions, except that the section entitled "GNU General Public License"
  18. may be included in a translation approved by the author instead of in
  19. the original English.
  20. File: dired,  Node: Top,  Next: Dired,  Prev: (dir),  Up: (dir)
  21.    This file documents Tree Dired (version 6), the GNU Emacs Directory
  22. Editor, including the optional "Dired Extra" features.
  23.    Tree Dired is an enhanced version of the Classic (18.xx Emacs) Dired
  24. and will be the Dired of Emacs 19.  It is known to work with Emacs
  25. 18.55 and 18.57 (and probably most earlier versions).
  26. Revision of this manual:
  27. $Id: dired.txi 1.1 1993/08/29 17:53:49 bpwing Exp $
  28. Report bugs to:
  29.      Sebastian Kremer <sk@thp.uni-koeln.de>
  30. * Menu:
  31. * Dired::            Dired, the Directory Editor
  32. * Tree Dired Extra::        Tree Dired Extra features
  33. * Dired Internals::        Dired Internals
  34. * Dired Known Problems::    Known Problems with Dired
  35.  -- Indices --
  36. * Dired Variable Index::
  37. * Dired Function Index::
  38. * Dired Key Index::
  39. * Dired Concept Index::
  40.  -- The Detailed Node Listing --
  41. Dired, the Directory Editor
  42. * Entering Dired::
  43. * Editing in Dired::
  44. * Listing Files in Dired::
  45. * Marking Files in Dired::
  46. * Mark-using Commands::
  47. * Commands That Do Not Use Marks::
  48. * Subdirectories in Dired::
  49. * Hiding Directories in Dired::
  50. * Acknowledgement::
  51. * Dired Customization::
  52. Mark-using Commands
  53. * Copy and Move Into a Directory::
  54. * Renaming and More With Regexps::
  55. * Other File Creating Commands::
  56. * Deleting Files With Dired::
  57. * Dired Shell Commands::
  58. * Compressing and Uncompressing::
  59. * Changing File Attributes::
  60. * Loading and Byte-compiling Emacs Lisp Files::
  61. * Printing the Marked Files::
  62. Dired Customization
  63. * Dired User Options::
  64. * Dired Configuration::
  65. * Dired Hooks::
  66. Tree Dired Extra features
  67. * Tree Dired Extra Features::
  68. * Dired Minibuffer History::
  69. * Inserting All Marked Subdirectories::
  70. * Dynamic Dired Markers::
  71. * Omitting Files in Dired::
  72. * Advanced Dired Mark Commands::
  73. * Virtual Dired::
  74. * Multiple Dired Directories::
  75. * Dired Local Variables::
  76. * Making Relative Symbolic Links in Dired::
  77. * Letting Dired Guess What Shell Command to Apply::
  78. * dired-trns.el::        Filename Transformers for Dired Shell Commands
  79. * dired-cd.el::            Changing the Working Directory for Dired Shell Commands
  80. * dired-nstd.el::        Nested Dired format
  81. * find-dired.el::        Feeding Find Output to Dired
  82. Dired Internals
  83. * Tree Dired Internals::
  84. * Dired Mark Internals::
  85. File: dired,  Node: Dired,  Next: Tree Dired Extra,  Prev: Top,  Up: Top
  86. Dired, the Directory Editor
  87. ***************************
  88.    Dired makes it easy to delete or visit many of the files in a single
  89. directory (and possibly its subdirectories) at once.  It makes an Emacs
  90. buffer containing a listing of the directories, in the format of `ls
  91. -lR'.  You can use the normal Emacs commands to move around in this
  92. buffer, and special Dired commands to operate on the files.  You can
  93. run shell commands on files, visit, compress, load or byte-compile
  94. them, change their file attributes and insert subdirectories into the
  95. same buffer.  You can "mark" files for later commands or "flag" them
  96. for deletion, either file by file or all files matching certain
  97. criteria.
  98. * Menu:
  99. * Entering Dired::
  100. * Editing in Dired::
  101. * Listing Files in Dired::
  102. * Marking Files in Dired::
  103. * Mark-using Commands::
  104. * Commands That Do Not Use Marks::
  105. * Subdirectories in Dired::
  106. * Hiding Directories in Dired::
  107. * Acknowledgement::
  108. * Dired Customization::
  109. File: dired,  Node: Entering Dired,  Next: Editing in Dired,  Prev: Dired,  Up: Dired
  110. Entering Dired
  111. ==============
  112. To invoke Dired, do `C-x d' or `M-x dired'.  The command reads a
  113. directory name or wildcard file name pattern as a minibuffer argument
  114. just like the `list-directory' command, `C-x C-d'. Invoking Dired with
  115. a prefix argument lets you enter the listing switches for the directory.
  116.    Dired assumes you meant to use a wildcard if the last component of
  117. the name is not an existing file.  Note that only the last pathname
  118. component may contain wildcards.  With wildcards it uses the shell to do
  119. the filename globbing, whereas usually it calls `ls' directly.  Because
  120. of this, you might have to quote characters that are special to the
  121. shell.  For example, to dired all auto-save files in your `~/mail/'
  122. directory, use `~/mail/\#*' as argument to Dired.  Note the backslash
  123. needed to quote `#' (at the beginning of a word) to the shell.
  124.    Where `dired' differs from `list-directory' is in naming the buffer
  125. after the directory name or the wildcard pattern used for the listing,
  126. and putting the buffer into Dired mode so that the special commands of
  127. Dired are available in it.  The variable `dired-listing-switches' is a
  128. string used as an argument to `ls' in making the directory; this string
  129. must contain `-l'.  Most other switches are also allowed, especially
  130. `-F', `-i' and `-s'.  For the `-F' switch to work you may have to set
  131. the variable `dired-ls-F-marks-symlinks', depending on what kind of
  132. `ls' program you are using.  *Note Dired Configuration::.
  133.    When a Dired buffer for the given directory already exists, it is
  134. simply selected without refreshing it.  You can type `g' if you suspect
  135. it is out of date.
  136.    To display the Dired buffer in another window rather than in the
  137. selected window, use `C-x 4 d' (`dired-other-window)' instead of `C-x
  138. File: dired,  Node: Editing in Dired,  Next: Listing Files in Dired,  Prev: Entering Dired,  Up: Dired
  139. Editing in Dired
  140. ================
  141. Once the Dired buffer exists, you can switch freely between it and other
  142. Emacs buffers.  Whenever the Dired buffer is selected, certain special
  143. commands are provided that operate on files that are listed.  The Dired
  144. buffer is "read-only", and inserting text in it is not useful, so
  145. ordinary printing characters such as `d' and `x' are used for Dired
  146. commands, and digits are prefix arguments.
  147.    The file described by the line that point is on is called the
  148. "current file".  The directory this file is in is the "current Dired
  149. directory".  Note that there may be several directories in one Dired
  150. buffer as long as they belong to the same tree.  The top level
  151. directory, the "root" of the tree, is used as the working directory of
  152. the buffer.
  153.    Some or all directories can be "hidden", leaving only their
  154. headerlines visible, and exlcuding their files from Dired operations.
  155.    Files can be "marked" for later commands.  Marking means putting a
  156. special character, usually `*', in the first column of the file line.
  157. To "flag" a file means to mark it for later deletion.  This special
  158. case of "marking" is distinguished so that you do not delete files
  159. accidentally.  Internally, the only difference between marking and
  160. flagging is the character used to mark the file: `*' (an asterisk) for
  161. a marked file, and `D' for files flagged for deletion.
  162.    Most Dired commands operate on the "marked" files and default to the
  163. current file.  They are the "mark-using" commands.  Deleting is the
  164. only mark-using command that does not default to the current file.
  165.    Dired buffers "know" about each other.  For example, copying from
  166. DIR1 into DIR2 will update DIR2's Dired buffer(s).  When you move files
  167. or directories, file and dired buffers are kept up to date and refer to
  168. the new location.  But Dired only knows about files changed by itself,
  169. not by other parts of Emacs or programs outside Emacs.
  170.    All the usual Emacs cursor motion commands are available in Dired
  171. buffers.  Some special purpose commands are also provided.  The keys
  172. `C-n' and `C-p' are redefined so that they try to position the cursor
  173. at the beginning of the filename on the line, rather than at the
  174. beginning of the line.
  175.    For extra convenience, SPC and `n' in Dired are equivalent to `C-n'.
  176. `p' is equivalent to `C-p'.  Moving by lines is also done so often in
  177. Dired that it deserves to be easy to type.  DEL (move up and unflag) is
  178. often useful simply for moving up.
  179. File: dired,  Node: Listing Files in Dired,  Next: Marking Files in Dired,  Prev: Editing in Dired,  Up: Dired
  180. Listing Files in Dired
  181. ======================
  182. Initially the Dired buffer shows the directory you selected.  The first
  183. line shows the full directory name.  It is an example of a "headerline"
  184. of a directory.  Note that it is terminated by a colon (`:') that is
  185. not part of the directory name.  The second line usually displays the
  186. total size of all files in the directory or the wildcard used.  Both
  187. are examples of "non-file lines".  Applying a command to a non-file
  188. line signals an error.  The other lines of the directory, called the
  189. "file lines", show information about each file such as permission bits,
  190. size and date of last modification, and the name of the file.
  191.    For example, the listing
  192.        /home/sk/lib/emacs/lisp:
  193.        total 4973
  194.        -rw-r--r--   1 sk       users      231608 Feb  6 16:58 ChangeLog
  195.        drwxr-sr-x   2 sk       users        2048 Feb  6 11:07 RCS
  196.        -r--r--r--   1 sk       users      141389 Feb  6 10:45 dired.el
  197.        -r--r--r--   1 sk       users      113033 Feb  5 16:21 dired.texi
  198.        ...
  199.      
  200.        /home/sk/lib/emacs/lisp/RCS:
  201.        total 4798
  202.        -r--r--r--   1 sk       users      231748 Feb  6 16:59 dired.texi,v
  203.        -r--r--r--   1 sk       users      763898 Feb  6 10:45 dired.el,v
  204.        ...
  205.    has a headerline for the `lisp' directory, a total line saying there
  206. are 4973 K in all the files of that directory (your `ls' program may
  207. use units of blocks instead), and several file lines.  After that, a
  208. headerline for the `RCS' subdirectory with its total line and its files
  209. follows.
  210.    Here is an example of a wildcard listing:
  211.        /home/sk/lib/emacs/lisp:
  212.        wildcard dired*
  213.        -rw-r--r--   1 sk       users      113036 Feb  6 16:59 dired.texi
  214.        -r--r--r--   1 sk       users       81267 Feb  6 16:29 dired.elc
  215.        -r--r--r--   1 sk       users       38436 Feb  6 16:28 dired-x.elc
  216.        -r--r--r--   1 sk       users       60258 Feb  6 16:27 dired-x.el
  217.        -r--r--r--   1 sk       users      141389 Feb  6 10:45 dired.el
  218.        ...
  219.    Since `ls' does not provide a total count when called with a wildcard
  220. argument, the second line now gives instead the wildcard used, here
  221. `dired*'.  If there would have been a directory matching the wildcard,
  222. e.g. a `dired/' subdirectory, its file line would be shown, but it
  223. would not have been expanded automatically.
  224.    Filenames may have embedded and trailing (but not leading) spaces.
  225. Leading spaces are not recognized because different `ls' programs
  226. differ in the amount of whitespace the insert before the filename.
  227. Filenames may *not* contain newlines or `^M''s.  You can get away with
  228. `^M''s in filenames if you do
  229.          (setq selective-display nil)
  230. in the Dired buffer (inside `dired-mode-hook', *Note Dired Hooks::.).
  231. But this also disables the `=' and `$' hiding commands, *Note Hiding
  232. Directories in Dired::.
  233.    Other unprintable characters than `^M' or newline (`^J') in
  234. filenames are no problem for Dired.  But your `ls' program may not
  235. output them correctly (e.g., replacing all unprintable characters with a
  236. question mark `?').  Dired can do nothing if `ls' suppresses
  237. information about the filenames.  But some (System V derived) `ls'
  238. programs have a `-b' switch to quote control characters, e.g.  `\n' for
  239. a newline character, or `\007' for a ASCII bell character (`C-g'), so
  240. you might want to add `b' to your switches (see below).  Dired
  241. translates the quoted control character escapes when a `-b' switch was
  242. used.  The `-b' switch is the recommended method to cope with funny
  243. filenames containing newlines or leading spaces.  But check if your
  244. `ls' understands `-b' and really quotes newlines and spaces.  Dired is
  245. known to work with GNU `ls -b', but other `ls -b' don't quote spaces,
  246. so leading spaces still don't work with these `ls' programs.
  247.    The appearance of the listing is determined by the listing switches
  248. used, for example whether you display or suppress `.' files with the
  249. `-a' and `-A' switches, use the `-F' switch to tag filenames etc.  It
  250. may additionally be restricted to certain files if you used wildcards
  251. to display only those files matching a shell file wildcard.
  252.    Dired has commands that change the listing switches for this buffer.
  253. They are mainly used to set the sort mode, but can also be used to
  254. change other formatting options.  The buffer is automatically refreshed
  255. after the switches are changed to let the new format take effect.
  256.    The default value for the switches comes from the variable
  257. `dired-listing-switches'; a prefix argument to `dired' can be use to
  258. determine the switches used for a specific buffer.  *Note Entering
  259. Dired::.  Each Dired buffer has its own value for the switches, stored
  260. in the variable `dired-actual-switches'.
  261.    The Dired modeline displays `by name' or `by date' to indicate the
  262. sort mode.  It uses the regexps in the variables
  263. `dired-sort-by-date-regexp' and `dired-sort-by-name-regexp' to decide
  264. what should be displayed.  If neither of the regexps matches, the
  265. listing switches are displayed literally.  You can use this to always
  266. display the literal switches instead of `by name' or `by date': set
  267. them to a regexp that never matches any listing switches, for example
  268. `^$'.
  269.    Most `ls' programs can only sort by name (without `-t') or by date
  270. (with `-t'), nothing else.  GNU `ls' additionally sorts on size with
  271. `-S', on extension with `-X', and unsorted (in directory order) with
  272. `-U'.  So anything that does not contain these is sort "by name".
  273. However, this is configurable in the variable
  274. `dired-ls-sorting-switches', which defaults to `"SXU"'.  It contains a
  275. string of `ls' switches (single letters) except `t' that influence
  276. sorting.  It is consulted at load time, so if you redefine it, you must
  277. do it before Dired is loaded.
  278.      (`dired-sort-toggle-or-edit') Toggle between sort by name/date and
  279.      refresh the dired buffer.  With a prefix argument you can edit the
  280.      current listing switches instead.
  281.    After some time the listing may become out of date because of
  282. actions by other programs than Dired.  You can refresh the complete
  283. Dired buffer from disk or only refresh the lines of certain files or a
  284. single file.
  285.      (`dired-do-redisplay') Redisplay all marked (or, with a prefix
  286.      argument, the next N) files.  As always, if no files are marked,
  287.      the current file is used.
  288.      If on a headerline, redisplay that subdirectory.  In that case, a
  289.      prefix arg lets you edit the `ls' switches used for the new
  290.      listing.
  291.      (`revert-buffer') The `g' command in Dired ultimately runs
  292.      `dired-revert' to reinitialize the buffer from the actual disk
  293.      directory (or directories).  All marks and flags in the Dired
  294.      buffer are restored, except of course for files that have
  295.      vanished.  Hidden subdirectories are hidden again.  *Note Hiding
  296.      Directories in Dired::.
  297.      (`dired-kill-line-or-subdir') Kill this line (but not this file).
  298.      Optional prefix argument is a repeat factor.  If file is displayed
  299.      as expanded subdirectory, kill that as well.
  300.      If on a subdirectory line, kill that subdirectory.  Reinsert it
  301.      with `i' (`dired-maybe-insert-subdir'), *Note Subdirectories in
  302.      Dired::.
  303.      Killing a file line means that the line is removed from the Dired
  304.      buffer.  The file is not touched, and the line will reappear when
  305.      the buffer is refreshed (using `g', `revert-buffer').  A killed
  306.      subdirectory will not reappear after reverting the buffer, since
  307.      `g' only list those subdirectories that were listed before.
  308. `M-k'
  309.      (`dired-do-kill') Kill all marked lines (not files).  With a prefix
  310.      argument, kill all lines not marked or flagged.
  311.      (For file marking, *Note Marking Files in Dired::.)
  312. `C-x u'
  313. `C-_'
  314.      (`dired-undo') Undo in a Dired buffer.  This doesn't recover lost
  315.      files, it is just normal undo with a temporarily writable buffer.
  316.      You can use it to recover marks, killed lines or subdirs.  In the
  317.      latter case, you have to do `M-x dired-build-subdir-alist' to
  318.      parse the buffer again for the new subdirectory list.
  319. File: dired,  Node: Marking Files in Dired,  Next: Mark-using Commands,  Prev: Listing Files in Dired,  Up: Dired
  320. Marking Files in Dired
  321. ======================
  322. This section describes commands to mark and unmark single files, and
  323. commands to mark several files at once if they match certain criteria.
  324. There also is a command to move to the next marked file.
  325.    As always, hidden subdirs are not affected.  *Note Hiding
  326. Directories in Dired::.
  327.      (`dired-mark-subdir-or-file') If on a file line, mark the current
  328.      file.  A numeric argument tells how many next or previous files to
  329.      mark.  If on a subdirectory header line, mark all its files except
  330.      `.' and `..'.
  331.      (`dired-unmark-subdir-or-file') Like `m', only unmarking instead
  332.      of marking.
  333. `DEL'
  334.      (`dired-backup-unflag') Move up lines and remove flags there.
  335.      Optional prefix argument says how many lines to unflag; default is
  336.      one line.
  337. `M-DEL'
  338.      (`dired-unflag-all-files') Remove a specific or all flags from
  339.      every file.  With an argument, queries for each marked file.  Type
  340.      your help character, usually `C-h', at that time for help.
  341.      (`dired-mark-executables') Mark all executable files.  With prefix
  342.      argument, unflag all those files.
  343.      (`dired-mark-symlinks') Mark all symbolic links.  With prefix
  344.      argument, unflag all those files.
  345.      (`dired-mark-directories') Mark all directory files except `.' and
  346.      `..'.  With prefix argument, unflag all those files.
  347.      (`dired-mark-files-regexp') Mark all files matching REGEXP for use
  348.      in later commands.  A prefix argument means to unmark them
  349.      instead.  `.' and `..' are never marked.
  350.      The match is against the non-directory part of the filename.  Use
  351.      `^' and `$' to anchor matches.  Exclude subdirs by hiding them.
  352.      This is an Emacs regexp, not a shell wildcard.    E.g., use `\.o$' for
  353.      object files - just `.o' will mark more than you might think.  By
  354.      default, the match is case sensitive (just like filenames), since
  355.      `case-fold-search' is set to `nil' in Dired buffers.
  356. `M-}'
  357.      (`dired-next-marked-file') Move to the next marked file, wrapping
  358.      around the end of the buffer.
  359. `M-{'
  360.      (`dired-prev-marked-file') Move to the previous marked file,
  361.      wrapping around the beginning of the buffer.
  362. File: dired,  Node: Mark-using Commands,  Next: Commands That Do Not Use Marks,  Prev: Marking Files in Dired,  Up: Dired
  363. Mark-using Commands
  364. ===================
  365.    Most Dired commands operate on the "marked" files and default to the
  366. current file.  They are the "mark-using" commands.  Deleting is the
  367. only mark-using command that does not default to the current file.
  368.    Mark-using Dired commands treat a numeric argument as a repeat count,
  369. meaning to act on the files of the next few lines instead of on the
  370. marked files.  That is, when you give a prefix argument the marks are
  371. not consulted at all.  A negative argument means to operate on the files
  372. of the preceding lines.  Either set of files is called "marked files"
  373. below, whether they really come from marks or from a prefix argument.
  374. The prompt of a mark-using command always makes clear which set of
  375. files is operated upon: it mentions either the marker character `*' or
  376. the `next N' files, where a negative N really means the previous -N
  377. files.
  378.    Thus you can use a prefix argument of `1' to apply a command to just
  379. the current file, e.g, if you don't want to disturb the other files you
  380. marked.  As digits are prefix arguments in Dired, simply type `1'
  381. followed by the command.
  382.    Many mark-using commands treat a prefix of N=0 specially, since it
  383. would otherwise be a no-op.
  384.    All mark-using commands display a list of files for which they
  385. failed.  Type `W' to see why a (mark-using or other) command failed.
  386. Error messages from shell commands (`stderr') cannot be redirected
  387. separately and goes together with the usual output (`stdout').
  388. * Menu:
  389. * Copy and Move Into a Directory::
  390. * Renaming and More With Regexps::
  391. * Other File Creating Commands::
  392. * Deleting Files With Dired::
  393. * Dired Shell Commands::
  394. * Compressing and Uncompressing::
  395. * Changing File Attributes::
  396. * Loading and Byte-compiling Emacs Lisp Files::
  397. * Printing the Marked Files::
  398. File: dired,  Node: Copy and Move Into a Directory,  Next: Renaming and More With Regexps,  Prev: Mark-using Commands,  Up: Mark-using Commands
  399. Copy, Move etc. Into a Directory
  400. --------------------------------
  401. This section explains commands that create a new file for each marked
  402. file, for example by copying (`c') or moving (`r') files.  They prompt
  403. in the minibuffer for a TARGET argument, usually the target directory
  404. in which the new files are created.  But if there is but one marked
  405. file, the target may also be a plain file.  (Otherwise you could not
  406. simply rename or copy a single file within the same directory.) Even
  407. with one marked file the target may still be an (existing) directory.
  408.    The target prompt displays a "default target" that will be used if
  409. you just type `RET'.  Normally the default target is the current Dired
  410. directory, so if you want to copy into some specific subdirectory, move
  411. point into that subdirectory before typing `c'.  But if there is a
  412. Dired buffer in the next window, and `dired-dwim-target' is true, its
  413. current Dired directory is used.  This makes it easy to copy from one
  414. Dired buffer into another if both are displayed.  On the other hand you
  415. have to use `C-x 1' to make other Dired buffers vanish if you do not
  416. want to have them as default targets.  To make Dired never look at the
  417. next window, set the variable `dired-dwim-target' to nil (`dwim' means
  418. Do What I Mean).  *Note Dired User Options::, on how to set
  419. cutomization variables.
  420.    As a general rule, Dired will not let you remove or overwrite a file
  421. without explicit confirmation.  Dired asks you for each existing target
  422. file whether or not to overwrite just this file (answer `y' or `n') or
  423. all remaining files (answer `!').  You can also type your help
  424. character, usually `C-h', at that time for help.
  425.      (`dired-do-copy') Copy the marked (or next N) files into a
  426.      directory, or copy a single file.
  427.      Thus, a zero prefix argument (N-0) copies nothing.  But it toggles
  428.      the variable `dired-copy-preserve-time'.
  429.      *Note Dired User Options::, on how to set customization variables.
  430.      (`dired-do-move') Move the marked files into a directory.  If
  431.      there is just one marked file, rename that file.  As the marked
  432.      files default to the current file, this can also be used to simply
  433.      rename the current file.
  434.      Dired silently changes the visited file name of buffers associated
  435.      with moved files so that they refer to the new location of the
  436.      file.
  437.      When a directory is renamed, its headerlines in Dired buffers are
  438.      updated, and any buffers visiting affected files have their
  439.      visited file name changed to refer to the new location.  Their
  440.      buffer name is changed if no buffer with such a name already
  441.      exists.  Affected files are all those which contain the directory
  442.      somewhere in their absolute path name.
  443.      A zero prefix arguments does not move any files, but toggles the
  444.      variable `dired-dwim-target'.
  445.      (`dired-do-hardlink') Make hard links from the target directory to
  446.      each marked file.
  447.      (`dired-do-symlink') Make symbolic links from the target directory
  448.      to each marked file.
  449.    Linking is very similar to copying in that new files are created
  450. while the old files stay.  If you want each newly copied or linked file
  451. to be marked with the same marker that its original has, set the
  452. variables `dired-keep-marker-copy', `dired-keep-marker-hardlink' or
  453. `dired-keep-marker-symlink' to `t'.  Set them to `nil' to not give
  454. these newly created files marks.  The default is to mark them with `C',
  455. `H' and `Y', respectively.
  456.    Moving differs from copying and linking in that the old file is
  457. removed as part of the creation of the new file.  Thus it makes sense
  458. to set the variable `dired-keep-marker-move' to `t' (the default) so
  459. that moved files "take their markers with them".
  460. File: dired,  Node: Renaming and More With Regexps,  Next: Other File Creating Commands,  Prev: Copy and Move Into a Directory,  Up: Mark-using Commands
  461. Renaming (and More) With Regexps
  462. --------------------------------
  463.    A second class of Commands uses regular expressions to construct a
  464. new filename from each marked file. *Note Syntax of Regular
  465. Expressions: (emacs)Regexps.  The commands to make new names by regexp
  466. conversion are the same as those to make them in another directory,
  467. except that they share a prefix char, `%'.
  468.      (`dired-rename-regexp') Rename files with regexps
  469.      (`dired-do-copy-regexp') Copy files with regexps.
  470.      (`dired-do-hardlink-regexp') Make hard links with regexps.
  471.      (`dired-do-symlink-regexp') Make symbolic links with regexps.
  472.    These commands prompt in the minibuffer for a REGEXP and a NEWNAME.
  473. For each marked file matching REGEXP, a new filename is constructed
  474. from NEWNAME.  The match can be anywhere in the file name, it need not
  475. span the whole filename.  Use `^' and `$' to anchor matches that should
  476. span the whole filename.  Only the first match in the filename is
  477. replaced with NEWTEXT.  (It would be easy to change this to replace all
  478. matches, but probably harder to use.)
  479.    `\&' in NEWNAME stands for the entire text being replaced.  `\D' in
  480. NEWNAME, where D is a digit, stands for whatever matched the D'th
  481. parenthesized grouping in REGEXP.  As each match is found, the user
  482. must type a character saying whether or not to apply the command to
  483. just this file (`y' or `n') or to all remaining files(`!').  For help
  484. type your help character, usually `C-h', at that time.
  485.    For example, if you want to rename all `.lsp' files to `.el' files,
  486. type first `%m' with `\.lsp$' as regexp to mark all `.lsp' files.  Then
  487. type `%r' with `\.lsp$' and `.el' as REGEXP and NEWTEXT arguments.
  488. Dired will prompt you for each file to be renamed.
  489.    Or to append `.old' to all marked files, use `%r' `$' `RET' `.old'
  490. `RET', replacing the empty string at the end of each file name with
  491. `.old'.
  492.    You can use the regexp `\(.+\)\.\(.+\)$' to make the basename as
  493. `\1' and the extension as `\2' available in NEWTEXT.
  494.    With a zero prefix arg, renaming by regexp affects the complete
  495. pathname.  Usually only the non-directory part of file names is used and
  496. changed, and renaming only takes place within the current directory.
  497. The zero prefix argument can be used to change the directory part as
  498. well.
  499.    Often you will want to apply the command to all files matching the
  500. same REGEXP that you use in the command.  Simply use the `%m' command
  501. with REGEXP as argument, which will then also be the default for the
  502. next regexp using command. For example, to remove a `V17I12-' prefix
  503. from several filenames, use `%m' `^V17I12-' `RET' `%r' `RET' `RET', in
  504. effect replacing the prefix with the empy string.
  505. File: dired,  Node: Other File Creating Commands,  Next: Deleting Files With Dired,  Prev: Renaming and More With Regexps,  Up: Mark-using Commands
  506. Other File Creating Commands
  507. ----------------------------
  508.    Commands to change the case of file names:
  509.      (`dired-upcase') Rename each marked file to upper case.
  510.      (`dired-downcase') Rename each marked file to lower case.
  511. File: dired,  Node: Deleting Files With Dired,  Next: Dired Shell Commands,  Prev: Other File Creating Commands,  Up: Mark-using Commands
  512. Deleting Files With Dired
  513. -------------------------
  514. Deleting is a special mark-using command.  It uses a special marker,
  515. `D', and does not default to the current file if no files are marked to
  516. prevent accidental deletions.
  517.    *Note Dired Customization::, variable `dired-del-marker' to make
  518. deleting behave exactly like any mark-using command.
  519.      (`dired-flag-file-deleted') Flag this file for deletion.  If on a
  520.      subdirectory headerline, mark all its files except `.' and `..'.
  521.      (`dired-unmark-subdir-or-file') Remove deletion-flag on this line.
  522. `DEL'
  523.      (`dired-backup-unflag') Remove deletion-flag on previous line,
  524.      moving point to that line.
  525.      (`dired-flag-regexp-files') Flag all files containing the specified
  526.      REGEXP for deletion.
  527.      The match is against the non-directory part of the filename.  Use
  528.      `^' and `$' to anchor matches.  Exclude subdirs by hiding them.
  529.      The special directories `.' and `..' are never flagged.
  530.      (`dired-do-deletions') Delete the files that are flagged for
  531.      deletion (with `D').
  532.      (`dired-do-delete') Delete the `*'-marked (as opposed to the
  533.      `D'-flagged) files.
  534.      (`dired-flag-auto-save-files') Flag all auto-save files (files
  535.      whose names start and end with `#') for deletion (*note
  536.      Auto-Saving: Protection Against Disasters: (emacs)Auto Save.).
  537.      (`dired-flag-backup-files') Flag all backup files (files whose
  538.      names end with `~') for deletion (*note Backup Files:
  539.      (emacs)Backup.).
  540. `. (Period)'
  541.      (`dired-clean-directory') Flag excess numeric backup files for
  542.      deletion.  The oldest and newest few backup files of any one file
  543.      are exempt; the middle ones are flagged.
  544.    You can flag a file for deletion by moving to the line describing the
  545. file and typing `d' or `C-d'.  The deletion flag is visible as a `D' at
  546. the beginning of the line.  Point is moved to the beginning of the next
  547. line, so that repeated `d' commands flag successive files.
  548.    The files are flagged for deletion rather than deleted immediately to
  549. avoid the danger of deleting a file accidentally.  Until you direct
  550. Dired to delete the flagged files, you can remove deletion flags using
  551. the commands `u' and DEL.  `u' works just like `d', but removes flags
  552. rather than making flags.  DEL moves upward, removing flags; it is like
  553. `u' with numeric argument automatically negated.
  554.    To delete the flagged files, type `x'.  This command first displays
  555. a list of all the file names flagged for deletion, and requests
  556. confirmation with `yes'.  Once you confirm, all the flagged files are
  557. deleted, and their lines are deleted from the text of the Dired buffer.
  558. The shortened Dired buffer remains selected.  If you answer `no' or
  559. quit with `C-g', you return immediately to Dired, with the deletion
  560. flags still present and no files actually deleted.
  561.    Deletions proceed from the end of the buffer, so if subdirs are in a
  562. natural order in the buffer, it usually works to flag `dir1',
  563. `dir1/dir2' and `dir1/dir2/*' (by typing `d' on the directory
  564. headerlines) and delete everything, including `dir1/dir2' and `dir1'.
  565. Using shell commands (e.g.  `rm -rf') to remove complete directories
  566. may be quicker than having Dired remove each file separately. (*Note
  567. Dired Shell Commands::.)  However, like all actions external to Dired,
  568. this does not update the display.
  569.    The `#', `~' and `.' commands flag many files for deletion, based on
  570. their names.  These commands are useful precisely because they do not
  571. actually delete any files; you can remove the deletion flags from any
  572. flagged files that you really wish to keep.
  573.    `#' flags for deletion all files that appear to have been made by
  574. auto-saving (that is, files whose names begin and end with `#').  `~'
  575. flags for deletion all files that appear to have been made as backups
  576. for files that were edited (that is, files whose names end with `~').
  577.    `.' (Period) flags just some of the backup files for deletion: only
  578. numeric backups that are not among the oldest few nor the newest few
  579. backups of any one file.  Normally `dired-kept-versions' (not
  580. `kept-new-versions'; that applies only when saving) specifies the
  581. number of newest versions of each file to keep, and `kept-old-versions'
  582. specifies the number of oldest versions to keep.  Period with a
  583. positive numeric argument, as in `C-u 3 .', specifies the number of
  584. newest versions to keep, overriding `dired-kept-versions'.  A negative
  585. numeric argument overrides `kept-old-versions', using minus the value
  586. of the argument to specify the number of oldest versions of each file
  587. to keep.
  588. File: dired,  Node: Dired Shell Commands,  Next: Compressing and Uncompressing,  Prev: Deleting Files With Dired,  Up: Mark-using Commands
  589. Shell Commands on Marked files
  590. ------------------------------
  591. You can run arbitrary shell commands on the marked files. If there is
  592. output, it goes to a separate buffer.
  593.      (`dired-do-shell-command') Run a shell command on the marked files.
  594.    A command string is prompted for in the minibuffer.  The list of
  595. marked files is appended to the command string unless asterisks `*'
  596. indicate the place(s) where the list should go.  Thus,
  597.      command -flags
  598.    is equivalent to
  599.      command -flags *
  600.    The filenames are inserted in the order they appear in the buffer.
  601. The file listed topmost in the buffer will be the leftmost in the list.
  602.    Currently, there is no way to insert a real `*' into the command.
  603.    As with all mark-using commands, if no files are marked or a specific
  604. numeric prefix arg is given, the current or the next N files are used.
  605. The prompt mentions the file(s) or the marker, as appropriate.
  606.    However, for shell commands, a zero argument is special. It means to
  607. run command on each marked file separately:
  608.      cmd * |foo
  609.    results in
  610.      cmd F1 |foo; ...; cmd FN |foo
  611.    Usually
  612.      cmd F1 ... FN |foo
  613.    would be executed.
  614.    No automatic redisplay is attempted because Dired cannot know what
  615. files should be redisplayed for a general shell command.  For example, a
  616. `tar cvf' will not change the marked files at all, but rather create a
  617. new file, while a `ci -u -m'...' *' will probably change the permission
  618. bits of all marked files.
  619.    Type `l' to redisplay just the marked files, or `l' on a directory
  620. headerline to redisplay just that directory, or `g' to redisplay all
  621. directories.
  622.    The shell command has the top level directory as working directory,
  623. so output files usually are created there instead of in a subdirectory,
  624. which may sometimes be surprising if all files come from the same
  625. subdirectory.  Just remember that an Emacs buffer can have but one
  626. working directory, and this is the top level directory in Dired buffers.
  627.    Examples for shell commands:
  628.    * Type `!' and
  629.           tar cvf foo.tar
  630.      to tar all marked files into a `foo.tar' file.  Dired does not know
  631.      that a new file has been created and you have to type `g' to
  632.      refresh the listing.  If you have several subdirectories in your
  633.      Dired buffer, the names given to `tar' will be relative to the top
  634.      level directory, and the output file `foo.tar' will also be created
  635.      there.
  636.      You can use
  637.           tar cvf - * | compress -c > foo.tar.Z
  638.      as an alternative to immediately compress the tar file.
  639.    * Type `0 !' and
  640.           uudecode
  641.      to uudecode each of the marked files.  Note the use of the zero
  642.      prefix argument to apply the shell command to each file separately
  643.      (uudecode doesn't accept a list of input files).  Type `g'
  644.      afterwards to see the created files.
  645.    * Type `0 !' and
  646.           uuencode * * >*.uu
  647.      to uuencode each of the marked files, writing into a corresponding
  648.      `.uu' file.  Note the use of the zero prefix argument to apply the
  649.      shell command to each file separately.  Type `g' afterwards to see
  650.      the created `.uu' files.
  651.    * Type `1 !' and
  652.           mail joe@somewhere <*
  653.      to mail the current file (note the prefix argument `1') to user
  654.      `joe@somewhere'.
  655.    * Here is a Dired shell command to execute the current file,
  656.      assuming no other files are marked (else just give the prefix `1'
  657.      to `!'):
  658.           ./*
  659.      which will be expanded to `./CMD', thus CMD will be executed..
  660.      (Just `./' would be expanded to `./ CMD', with an intervening
  661.      `SPC'.)  This will work even if you don't have `.' in your
  662.      `$PATH'.  If `.' is in your path (not a good idea, as you will
  663.      find out if you dired a directory containing a file named `ls'), a
  664.      single `SPC' as command would also work.
  665. File: dired,  Node: Compressing and Uncompressing,  Next: Changing File Attributes,  Prev: Dired Shell Commands,  Up: Mark-using Commands
  666. Compressing and Uncompressing
  667. -----------------------------
  668. You can compress or uncompress the marked files.  Dired refuses to
  669. compress files ending in `.Z' (which are already compressed) or
  670. symbolic links (the link would be overwritten by a plain, compressed
  671. file) and to uncompress files not ending in `.Z'.
  672.      (`dired-do-compress') Compress the marked files.
  673.      (`dired-do-uncompress') Uncompress the marked files.
  674. File: dired,  Node: Changing File Attributes,  Next: Loading and Byte-compiling Emacs Lisp Files,  Prev: Compressing and Uncompressing,  Up: Mark-using Commands
  675. Changing File Attributes
  676. ------------------------
  677. You can change the file attributes (mode, group, owner) of marked files.
  678.      (`dired-do-chmod') Change the mode (also called "permission bits")
  679.      of the marked files.  This calls the `chmod' program, thus
  680.      symbolic modes like `g+w' are allowed.
  681.      Multiple switches like `-fR g+w' are not understood, though.  Use
  682.      `!' (`dired-do-shell-command') for that.
  683.      (`dired-do-chgrp') Change the group of the marked files.
  684.      (`dired-do-chown') Change the owner of the marked files.  This
  685.      usually works for the superuser only.  It uses the program in the
  686.      variable `dired-chown-program' to do the change.
  687. File: dired,  Node: Loading and Byte-compiling Emacs Lisp Files,  Next: Printing the Marked Files,  Prev: Changing File Attributes,  Up: Mark-using Commands
  688. Loading and Byte-compiling Emacs Lisp Files
  689. -------------------------------------------
  690. You can load and byte-compile GNU Emacs Lisp files.  Errors are caught
  691. and reported after all files have been processed.
  692.      (`dired-do-load') Load the marked elisp files.
  693.      (`dired-do-byte-compile') Byte compile the marked elisp files.
  694. File: dired,  Node: Printing the Marked Files,  Prev: Loading and Byte-compiling Emacs Lisp Files,  Up: Mark-using Commands
  695. Printing the Marked Files
  696. -------------------------
  697.      (`dired-do-print') Print the marked (or next N) files.  Uses the
  698.      shell command coming from variables `lpr-command' and
  699.      `lpr-switches' as default.
  700.      Since internally this is just a special case of
  701.      `dired-do-shell-command', you can use `*' and pipes like for shell
  702.      command, e.g.,
  703.           (setq lpr-command: "lwf")
  704.           (setq lpr-switches: '("-l -m * | lpr -Palw"))
  705.      to print with the shell command `lwf -l -m * | lpr -Palw', where
  706.      `*' will be substituted by the marked files.  The `lpr-buffer' and
  707.      `lpr-region' don't know about `*' or `|', though, only Dired does.
  708. File: dired,  Node: Commands That Do Not Use Marks,  Next: Subdirectories in Dired,  Prev: Mark-using Commands,  Up: Dired
  709. Commands That Do Not Use Marks
  710. ==============================
  711. These are commands that visit files.  *Note Visiting Files:
  712. (emacs)Visiting.
  713.      (`dired-advertised-find-file') Visits the file described on the
  714.      current line.  It is just like typing `C-x C-f' and supplying that
  715.      file name.  If the file on this line is a subdirectory, `f'
  716.      actually causes Dired to be invoked on that subdirectory.
  717.      (`dired-find-file-other-window') Like `f', but uses another window
  718.      to display the file's buffer.  The Dired buffer remains visible in
  719.      the first window.  This is like using `C-x 4 C-f' to visit the
  720.      file.  *Note Multiple Windows: (emacs)Windows.
  721.      (`dired-view-file') Views the file described on this line using
  722.      `M-x view-file'.  Viewing a file is like visiting it, but is
  723.      slanted toward moving around in the file conveniently and does not
  724.      allow changing the file.  *Note View File: (emacs)Misc File Ops.
  725.      Viewing a file that is a directory goes to its headerline if it is
  726.      in this buffer.  Otherwise, it is displayed in another buffer.
  727. Commands to diff a file:
  728.      (`dired-diff') Compare file at point with another file (default:
  729.      file at mark), by running the system command `diff'.  The other
  730.      file is the first file given to `diff'.
  731. `M-~'
  732.      (`dired-backup-diff') Diff this file with its backup file.  Uses
  733.      the latest backup, if there are several numerical backups.  If
  734.      this file is a backup, diff it with its original.  The backup file
  735.      is the first file given to `diff'.
  736. Other commands:
  737.      (`dired-create-directory') Create a directory.
  738.      (`dired-why') Pop up a buffer with error log output from Dired.
  739.      All mark-using commands log errors there.  (Standard error from
  740.      shell commands cannot be logged separately, it goes into the usual
  741.      shell command output buffer.)  A group of errors from a single
  742.      command ends with a formfeed, so that you can use `C-x ['
  743.      (`backward-page') to find the beginning of new error logs that are
  744.      reported by a command.
  745. File: dired,  Node: Subdirectories in Dired,  Next: Hiding Directories in Dired,  Prev: Commands That Do Not Use Marks,  Up: Dired
  746. Subdirectories in Dired
  747. =======================
  748. Thise section explains how to "insert" (or "expand") subdirectories in
  749. the same Dired buffer and move around in them.
  750.    You can display subdirectories in your Dired buffer by using `-R' in
  751. your Dired listing switches.  But you do not usually want to have a
  752. complete recursive listing in all your Dired buffers.  So there is a
  753. command to insert a single directory:
  754.      (`dired-maybe-insert-subdir') Insert this subdirectory into the
  755.      same Dired buffer.  If it is already present, just move to it (type
  756.      `l', `dired-do-redisplay' to refresh it).  Else inserts it as `ls
  757.      -lR' would have done.  With a prefix arg, you may edit the ls
  758.      switches used for this listing.  You can add `R' to the switches to
  759.      expand the whole tree starting at this subdirectory.  This function
  760.      takes some pains to conform to `ls -lR' output.  For example, it
  761.      adds the headerline for the inserted subdirectory.
  762.      The mark is dropped before moving, so `C-x C-x' takes you back to
  763.      the old position in the buffer.
  764.    Dired changes the buffer-local value of the variable
  765. `page-delimiter' to `"\n\n"', so that subdirectories become pages.
  766. Thus, the page moving commands `C-x [' and `C-x ]' (`backward-page' and
  767. `forward-page') can be used to move to the beginning (i.e., the
  768. headerlines) of subdirectories.
  769.    In addition, the following commands move around directory-wise,
  770. usually putting you on a file line instead of on a headerline.  For a
  771. mnemonic, note that they all look like rotated versions of each other,
  772. and that they move in the direction they point to.
  773.      (`dired-prev-dirline') Goto previous directory file line.
  774.      (`dired-next-dirline') Goto next directory file line.
  775.      (`dired-up-directory') Dired parent directory.  Tries first to find
  776.      its file line, then its header line in this buffer, then its Dired
  777.      buffer, finally creating a new Dired buffer if necessary.
  778.      (`dired-view-file') When the current file is not a directory, view
  779.      it.  When file is a directory, tries to go to its subdirectory.
  780.      This command is inverse to the `^' command and it is very
  781.      convenient to use these two commands together.
  782.    The following commands move up and down in the directory tree:
  783. `M-C-u'
  784.      (`dired-tree-up') Go up to the parent directory's headerline.
  785. `M-C-d'
  786.      (`dired-tree-down') Go down in the tree, to the first
  787.      subdirectory's headerline.
  788.    The following commands move forwards and backwards to subdirectory
  789. headerlines:
  790. `M-C-n'
  791.      (`dired-next-subdir') Go to next subdirectory headerline,
  792.      regardless of level.
  793. `M-C-p'
  794.      (`dired-prev-subdir') Go to previous subdirectory headerline,
  795.      regardless of level.
  796. File: dired,  Node: Hiding Directories in Dired,  Next: Acknowledgement,  Prev: Subdirectories in Dired,  Up: Dired
  797. Hiding Directories in Dired
  798. ===========================
  799. "Hiding" a subdirectory means to make it invisible, except for its
  800. headerline.  Files inside a hidden subdirectory are never considered by
  801. Dired.  For example, mark-using commands will not "see" files in a
  802. hidden directory.  Thus you can use hiding to temporarily exclude
  803. subdirectories from operations without having to remove the markers.
  804.    The hiding commands toggle, that is they unhide what was hidden and
  805. vice versa.
  806.      (`dired-hide-subdir') Hide or unhide the current subdirectory and
  807.      move to next directory.  Optional prefix argument is a repeat
  808.      factor.
  809.      (`dired-hide-all') Hide all subdirectories, leaving only their
  810.      header lines.  If there is already something hidden, make
  811.      everything visible again.  Use this command to get an overview in
  812.      very deep directory trees or to move quickly to subdirs far away.
  813. File: dired,  Node: Acknowledgement,  Next: Dired Customization,  Prev: Hiding Directories in Dired,  Up: Dired
  814. Acknowledgement
  815. ===============
  816. I would like to thank
  817.    * Richard Stallman for providing a pre-release version of `dired.el'
  818.      from Emacs 19, critical comments and many helpful suggestions
  819.    * Andy Norman for the collaboration that made Tree Dired and
  820.      ange-ftp such a successful combination
  821.    * Jamie Zawinski for insisting on and writing nested Dired format,
  822.      and for lots of other things
  823.    * Michael Ernst for the "omitting" code and helpful discussion about
  824.      Dired design
  825.    * Hans Chalupsky for providing FTP service and writing
  826.      `dired-trns.el'
  827.    * Roland McGrath for `find-dired.el' and bug fixes for the diffing
  828.      commands
  829.    * Kevin Gallagher for sending me existing VMS Dired fixes
  830.    * Hal R. Brand for VMS support and porting his old dired fixes to
  831.      Tree Dired
  832.    * Hugh Secker-Walker for writing `dired-cd.el'
  833.    * Tom Wurgler for ideas such as the "dired-jump-back" command
  834.    * Cengiz Alaettinoglu, who found more bugs in Tree Dired than
  835.      anybody else (except me)
  836. and all other beta testers and people who reported bugs or just said
  837. "thanks".
  838. File: dired,  Node: Dired Customization,  Prev: Acknowledgement,  Up: Dired
  839. Dired Customization
  840. ===================
  841. You can customize Dired by setting some variables in your `~/.emacs'
  842. file.  Other variables are intended to be configured when Dired is
  843. installed.  Finally, there are so-called `hook' variables.
  844. * Menu:
  845. * Dired User Options::
  846. * Dired Configuration::
  847. * Dired Hooks::
  848.